﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class _Default : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        this.Label1.Text = "Web页中的系统时间:" + DateTime.Now.ToString();
    }
    protected void Page_Init(Object sender,EventArgs e)
    {
        this.Label1.Text = "Web页中的系统时间:" + DateTime.Now.ToLongTimeString();
        PartialCachingControl pcc = LoadControl("WebUserControl.ascx") as PartialCachingControl;
        if(pcc.CachePolicy.Duration>TimeSpan.FromSeconds(60))
        {
            pcc.CachePolicy.SetExpires(DateTime.Now.Add(TimeSpan.FromSeconds(20)));
            pcc.CachePolicy.SetSlidingExpiration(false);
        }
        Controls.Add(pcc); 
    }
}